<template>
<tr>
  <td>{{name}}</td>
  <td>{{code}}</td>
  <td>{{platformText}}</td>
  <td>
    <a :href="`#/role-permit-${platType}-${roleId}`" class="badge badge-info" title="权限">
      <span class="far fa-user"> 权限</span>
    </a>
    &nbsp;
    <a href="javascript:void(0);" class="badge badge-info" title="编辑" v-on:click="$emit('edit',index)">
      <span class="far fa-edit"> 编辑</span>
    </a>
    &nbsp;
    <a href="javascript:void(0);" class="badge badge-info" title="删除" v-on:click="$emit('del',index)">
      <span class="far fa-trash-alt"> 删除</span>
    </a>
    &nbsp;
  </td>
</tr>
</template>
<script>
  import { platforms } from '../dist/js/enum'

  export default {
    name: 'RoleListItem',
    props: {
      index: Number,
      roleId: Number,
      name: String,
      code: String,
      platform: Number
    },
    computed: {
      platformText() {
        return platforms[this.platform].text
      },
      platType() {
        return platforms[this.platform].name.toLowerCase()
      }
    }
  }
</script>